<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>调度管理</title>
<meta name="viewport" content="width=device-width, initial-scale=1"> 
	<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
	<script src="__PUBLIC__/js/jquery-1.7.2.min.js"></script>
	<script src="__PUBLIC__/js/jquery.validate.js"></script>
	<!-- <script src="__PUBLIC__/js/jquery.metadata.js"></script> -->
    <script src="__PUBLIC__/js/messages_cn.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/Css/jquery.validate.css" />
	<link rel="stylesheet" href="__PUBLIC__/Css/jquery.mobile-1.2.0.css" />		
	<script src="__PUBLIC__/js/jquery.mobile-1.2.0.js"></script>
    <script type="text/javascript">
      $().ready(function() {
    	 $("#customer").validate();  
    	});
    </script>
</head>
<body>
	<div data-role="page"> 
	
	   <div data-role="header" data-position="fixed">　
	       <a href="__URL__/BlockOutcontrol" rel="external" data-role="button" data-icon="back">后退</a>
           <div style="text-align:center;" id="payondelivery">添加调度</div>   
           <a href="#" data-role="button" data-icon="refresh">刷新</a></div> 
		<div data-role="content">
			<form method="post" action="__URL__/BlockOutcontrol/insert/true" data-ajax="false"
				id="control">
				<input type="hidden" name="contractlogid" value="{$contractlogid}">
				<input type="hidden" name="shipper" id="shipper"/> <input
					type="hidden" name="provider" id="provider"/> <input
					type="hidden" name="operator"
					value="<?php echo $_SESSION[C(USER_AUTH_KEY)]?>" /> <input
					type="hidden" name="controldate" id="controldate"
					value="<?php echo date('YmdHis')?>"/>
				<table align="center">
					<tr>
						<td><label for="orders">订单号：</label></td>
						<td><input name="orders" type="text" id="orders" readonly
							value="<?php echo date('YmdHis')?>" style="width: 360px;" /></td>
					</tr>
					<tr>
						<td><label for="shipper" class="select">发货方：</label></td>
						<td><select name="shipper" id="shipper" data-mini="true"
							class="required">
								<option value="">请选择</option>
								<volist id="sub" name="subcompany">
								<option value="{$sub.subname}">{$sub.subname}</option>
								</volist>
						</select></td>
					</tr>
					<tr>
					<!-- 
						<td><label for="customer" class="select">客户：</label></td>
						<td><select name="customer" id="customer" data-mini="true"
							class="required">
								<option value="">请选择</option>
								<volist name="list4" id="vo">
								<option value="{$vo.id}">{$vo.customername}</option>
								</volist>
						</select>
						</td>
						 -->
					<?php  
					 if(empty($customer)){
					?>
					<td><label for="customer" class="select">客户：</label></td>
					<td><select name="customer" id="customer" data-mini="true"
							class="required">
								<option value="">请选择</option>
								<volist name="list4" id="vo">
								<option value="{$vo.id}">{$vo.customername}</option>
								</volist>
						</select>
					</td>
					<?php 
					}else{
					?>
					<td><label for="customer" class="select">客户：</label></td>
					<?php
					if($payondelivery==1){
                       ?>
                       <span style='color:red;'>注意： 该客户为款到卸车</span>
                       <?php
                       }
					?>
					 <input type="hidden" name="customer" value ="{$customerid}">
                    <td> <input type="text" name="customername" value ="{$customer}" readonly="readonly">
					</td>
					<?php
					}
					?>
						
					</tr>
					<tr>
					<!-- 
						<td><label for="provider" class="select">供应商：</label></td>
						<td><select name="provider" id="provider" data-mini="true"
							class="required">
								<option value="">请选择</option>
								<volist name="list2" id="vo">
								<option value="{$vo.id}">{$vo.providername}</option>
								</volist>
						</select></td>
						 -->
						<?php  
					 if(empty($provider)){
					?>
					<td><label for="provider" class="select">供应商：</label></td>
					<td><select name="provider" id="provider" data-mini="true"
							class="required">
								<option value="">请选择</option>
								<volist name="list2" id="vo">
								<option value="{$vo.id}">{$vo.providername}</option>
								</volist>
						</select></td>
					<?php 
					}else{
					?>
					<td><label for="provider" class="select">供应商：</label></td>
					<input type="hidden" name="provider" value ="{$providerid}">
                    <td><input type="text" name="providername" value ="{$provider}" readonly="readonly">
					</td>
					<?php
					}
					?>
						
					</tr>
					<tr>
						<td><label for="start" class="select">起运地：</label></td>
						<td><select name="start" id="start" data-mini="true"
							class="required">
								<option value="">请选择</option>
								<volist name="freight" id="vo">
								<option value="{$vo.startaddress}">{$vo.startaddress}</option>
								</volist>
						</select></td>
					</tr>
					<tr>
						<td><label for="destination" class="select">目的地：</label></td>
						<td><select name="destination" id="destination"
							data-mini="true" class="required">
								<option value="">请选择</option>
								<volist name="end" id="vo">
								<option value="{$vo.endaddress}">{$vo.endaddress}</option>
								</volist>
						</select></td>
					</tr>
					<tr>
						<td><label for="carrier" class="select">承运方：</label></td>
						<td><select name="carrier" id="carrier" data-mini="true"
							class="required">
								<option value="">请选择</option>
								<volist name="list3" id="vo">
								<option value="{$vo.id}">{$vo.carriername}</option>
								</volist>
						</select></td>
					</tr>
					<tr>
						<td><label for="useid" class="select">接车人：</label></td>
						<td><select name="userid" id="userid" data-mini="true"
							class="required">
								<option value="">请选择</option>
								<volist name="user" id="vo">
								<option value="{$vo.fullname}">{$vo.fullname}</option>
								</volist>
						</select></td>
					</tr>
				
					<tr>
						<td><label for="carno">车牌号：</label></td>
						<td><input name="carno" id="carno" type="text" required
							/></td>
					</tr>
					<tr>
						<td><label for="carstat" class="select">车辆状态：</label></td>
						<td><select name="carstat" id="carstat" data-mini="true">
								<option value="">请选择</option>
								<option value="2">待发货</option>
								<!-- 车辆状态为2表示车待发货，等待输入吨数 -->
						</select></td>
					</tr>
					<!-- 
					<tr>
						<td><label for="product" class="select">产品名称：</label></td>
						<td><select name="product" id="product" data-mini="true"
							class="required">
								<option value="">请选择</option>
								<volist name="goods" id="vo">
								<option value="{$vo.goodsname}">{$vo.goodsname}</option>
								</volist>
						</select></td>
					 -->	
						<?php
			if(empty($product)){
               ?>
            <td><label for="product" class="select">产品名称：</label></td>
			<td><select name="product" id="product" data-mini="true"
							class="required">
								<option value="">请选择</option>
								<volist name="goods" id="vo">
								<option value="{$vo.goodsname}">{$vo.goodsname}</option>
								</volist>
						</select></td>
            <?php
                }else{
             ?>
              <td><label  id="cusproduct">产品名称：</label></td> 
              <td><input type="text" name="product" value ="{$product}" readonly="readonly"></td>
            <?php
                }
			?>
					</tr>
					<tr>
						<td><label>备注：</label></td>
						<td><textarea name="note" cols="56" style="width: 360px;"
								rows="3"></textarea></td>
					</tr>
					<tr>
						<td colspan="2">
							<div data-type="horizontal" data-role="controlgroup"
								style="text-align: center;">
								<input type="submit" value="保存" data-icon="check"/> <a href="__URL__/index"
									rel="external" data-rel="back" data-role="button" >取消</a>
						    </div>
						</td>
					</tr>
				</table>
					<script type="text/javascript">
						$('#customer').change(function() {
							var customervalue = $(this).val();
							$.post('__URL__/add/ajax/a', {
								customer : customervalue
							}, function(data) {
								var myjson = '';
								eval('myjson=' + data + ';');
								if(myjson.status!==''){
									$('#payondelivery').html(myjson.status);
								}else{
									$('#payondelivery').html('添加调度');
								}
							});
						});
					</script>
			</form>
		</div>
		</div>
</body>
</html>